package com.ph.website.home.base.common;

import lombok.Data;

import java.util.Map;

@Data
public class RequestInfo {

    private Long requestId;             //请求编号
    private String url;                 //请求url
    private String token;               //客户端token
    private String host;                //客户端ip
    private Map<String,String> headers; //请求头
    private Map<String,String> params;  //客户端请求参数
    private Integer code;               //返回状态码
    private Integer time;               //请求耗时
    private Long startTime;             //请求开始时间戳

    private static ThreadLocal<RequestInfo> info = new ThreadLocal<>();

    public static RequestInfo get(){
        return info.get();
    }

    public static void set(RequestInfo value){
        info.set(value);
    }

    public static void remove(){
        info.remove();
    }
}
